package org.jivesoftware.openfire.redischat;


import org.jivesoftware.database.JiveID;
import org.jivesoftware.util.JiveConstants;
import org.xmpp.component.Component;
import org.xmpp.component.ComponentException;
import org.xmpp.component.ComponentManager;
import org.xmpp.packet.JID;
import org.xmpp.packet.Packet;

@JiveID(JiveConstants.MUC_SERVICE)
public interface RedisMultiUserChatService extends Component {

    /**
     * Returns the fully-qualifed domain name of this chat service.
     * The domain is composed by the service name and the
     * name of the XMPP server where the service is running.
     * 
     * @return the chat server domain (service name + host name).
     */
	String getServiceDomain();

	/**
     * Returns the subdomain of the chat service.
     *
     * @return the subdomain of the chat service.
     */
	String getServiceName();

	/**
     * Returns the name of this component.
     *
     * @return the name of this component.
     */
	String getName();

	/**
     * Returns the description of this component.
     *
     * @return the description of this component.
     */
	String getDescription();

	/**
     * Processes a packet sent to this Component.
     *
     * @param packet the packet.
     * @see ComponentManager#sendPacket(Component, Packet)
     */
	void processPacket(Packet paramPacket);

	/**
     * Initializes this component with a ComponentManager and the JID
     * that this component is available at (e.g. <tt>service.example.com</tt>). If a
     * ComponentException is thrown then the component will not be loaded.<p>
     *
     * The initialization code must not rely on receiving packets from the server since
     * the component has not been fully initialized yet. This means that at this point the
     * component must not rely on information that is obtained from the server such us
     * discovered items.
     *
     * @param jid the XMPP address that this component is available at.
     * @param componentManager the component manager.
     * @throws ComponentException if an error occured while initializing the component.
     */
	void initialize(JID paramJID,
			ComponentManager paramComponentManager) throws ComponentException;

	/**
     * Notification message indicating that the component will start receiving incoming
     * packets. At this time the component may finish pending initialization issues that
     * require information obtained from the server.<p>
     *
     * It is likely that most of the component will leave this method empty.
     */
	void start();

	/**
     * Shuts down this component. All component resources must be released as
     * part of shutdown.
     */
	void shutdown();

	/**
     * Returns true if the MUC service is a hidden, externally managed, service.  This is typically
     * set to true when the implementation is not the default one, and is not to be managed by
     * the standard Openfire interface.  If this is set to true, the service will not show up in
     * the service list in the admin console.
     *
     * @return true if the MUC service is hidden and externally managed.
     */
	boolean isHidden();

	void setDescription(String description);
	
	void send(Packet packet, RedisMUCRoom room);

}
